package main

import "fmt"

type Person struct {
	Subject1 string
	Subject2 string
}

func main()  {
	s := make(map[string]interface{})
	s["name"] = "xiaoming"
	s["age"] = 12
	s["subjects"]=[]string{"python", "go"}  //如果要获取切片类型的属性，则需要使用类型断言

	//fmt.Println(s["subjects"][1])  //报错，没有index索引

	subjects, _ := s["subjects"].([]string)
	fmt.Println(subjects[1], subjects[0])

	// 同理结构体一样
	p := Person{
		Subject1: "go",
		Subject2: "js",
	}

	s["subjects"] = p
	subject, _ := s["subjects"].(Person)
	fmt.Println(subject.Subject1, subject.Subject2)
}